package com.khotyn.heresy.controller;

import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.khotyn.heresy.bean.HeresyErrorMessage;

/**
 * 注销控制器
 * 
 * @author 黄挺
 * 
 */
@Controller
@RequestMapping("/logout.html")
public class LogOutController {
	@RequestMapping(method = RequestMethod.GET)
	public ModelAndView onLoad(HttpSession session) {
		Integer userID = (Integer) session.getAttribute("userID");
		HeresyErrorMessage message = null;

		if (userID != null) {
			session.removeAttribute("userID");
		}

		message = new HeresyErrorMessage("注销成功", "注销成功，即将跳转到主页", "index.html");
		return new ModelAndView("message", "message", message);
	}
}
